package com.freewater.springboot.demo.spel.methodinvoke;

import com.freewater.springboot.demo.spel.Society;
import org.springframework.expression.ExpressionParser;
import org.springframework.expression.spel.standard.SpelExpressionParser;

public class Main {
    public static void main(String[] args) {

        ExpressionParser parser = new SpelExpressionParser();
        final String subString = parser.parseExpression("'abc'.substring(1, 3)").getValue(String.class);
        System.out.println(subString);

        Society society = new Society();
        final Boolean isMember = parser.parseExpression("isMember('Mihajlo Pupin')").getValue(society, Boolean.class);
        System.out.println(isMember);
    }
}
